using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableHeroDao:DaoBase<TableHero>
    {
        public override void AddPrimaryIndex(TableHero model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableHero.txt";
        }

        protected override TableHero ParseRowData(string[] rowData)
        {
            TableHero data = new TableHero();
			data.id = rowData [0];
			data.name = rowData [1];
			data.desc = rowData [2];
			data.resName = rowData [3];
			data.iconName = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.space = 0;
            }
            else
            {
                data.space = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.sex = 0;
            }
            else
            {
                data.sex = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.quality = 0;
            }
            else
            {
                data.quality = int.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.heroClass = 0;
            }
            else
            {
                data.heroClass = int.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.aiProperty = 0;
            }
            else
            {
                data.aiProperty = int.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.expBase = 0;
            }
            else
            {
                data.expBase = int.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.selloutPrice = 0;
            }
            else
            {
                data.selloutPrice = int.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.hpBase = 0;
            }
            else
            {
                data.hpBase = double.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.attBase = 0;
            }
            else
            {
                data.attBase = double.Parse(rowData[13]);
            }

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.pdefBase = 0;
            }
            else
            {
                data.pdefBase = double.Parse(rowData[14]);
            }

            if (string.IsNullOrEmpty(rowData[15]))
            {
                data.mdefBase = 0;
            }
            else
            {
                data.mdefBase = double.Parse(rowData[15]);
            }

            if (string.IsNullOrEmpty(rowData[16]))
            {
                data.hit = 0;
            }
            else
            {
                data.hit = double.Parse(rowData[16]);
            }

            if (string.IsNullOrEmpty(rowData[17]))
            {
                data.dodge = 0;
            }
            else
            {
                data.dodge = double.Parse(rowData[17]);
            }

            if (string.IsNullOrEmpty(rowData[18]))
            {
                data.cri = 0;
            }
            else
            {
                data.cri = double.Parse(rowData[18]);
            }

            if (string.IsNullOrEmpty(rowData[19]))
            {
                data.antiCri = 0;
            }
            else
            {
                data.antiCri = double.Parse(rowData[19]);
            }

            if (string.IsNullOrEmpty(rowData[20]))
            {
                data.criFactor = 0;
            }
            else
            {
                data.criFactor = double.Parse(rowData[20]);
            }

            if (string.IsNullOrEmpty(rowData[21]))
            {
                data.damageAdd = 0;
            }
            else
            {
                data.damageAdd = double.Parse(rowData[21]);
            }

            if (string.IsNullOrEmpty(rowData[22]))
            {
                data.damageReduce = 0;
            }
            else
            {
                data.damageReduce = double.Parse(rowData[22]);
            }

            if (string.IsNullOrEmpty(rowData[23]))
            {
                data.DefaultState = 0;
            }
            else
            {
                data.DefaultState = int.Parse(rowData[23]);
            }
			data.SkillId1 = rowData [24];
			data.SkillId2 = rowData [25];
			data.UltSkillId = rowData [26];

            if (string.IsNullOrEmpty(rowData[27]))
            {
                data.Height = 0;
            }
            else
            {
                data.Height = double.Parse(rowData[27]);
            }

            if (string.IsNullOrEmpty(rowData[28]))
            {
                data.Weight = 0;
            }
            else
            {
                data.Weight = double.Parse(rowData[28]);
            }

            if (string.IsNullOrEmpty(rowData[29]))
            {
                data.Length = 0;
            }
            else
            {
                data.Length = double.Parse(rowData[29]);
            }

            if (string.IsNullOrEmpty(rowData[30]))
            {
                data.ScaleFactor = 0;
            }
            else
            {
                data.ScaleFactor = double.Parse(rowData[30]);
            }
			data.BeFoundBone = rowData [31];

            if (string.IsNullOrEmpty(rowData[32]))
            {
                data.RushFlyTime = 0;
            }
            else
            {
                data.RushFlyTime = double.Parse(rowData[32]);
            }

            if (string.IsNullOrEmpty(rowData[33]))
            {
                data.RushFallTime = 0;
            }
            else
            {
                data.RushFallTime = double.Parse(rowData[33]);
            }

            if (string.IsNullOrEmpty(rowData[34]))
            {
                data.JumpBackFlyTime = 0;
            }
            else
            {
                data.JumpBackFlyTime = double.Parse(rowData[34]);
            }

            if (string.IsNullOrEmpty(rowData[35]))
            {
                data.JumpBackFallTime = 0;
            }
            else
            {
                data.JumpBackFallTime = double.Parse(rowData[35]);
            }
			data.ImposState = rowData [36];
			data.expeditionSkill = rowData [37];
			data.WinVoiceAudio = rowData [38];

            return data;
        }



    }

}
